import redis

VERSION = 1002
__author__ = 'mud'


class RedisHelper:

    def __init__(self, host='localhost', port=6379):
        self.db = redis.StrictRedis(host, port)

    def put(self, key, value):
        if self.db.set(key, value):
            return 'ok'

    def get(self, key):
        reply = self.db.get(key)
        if reply is None:
            reply = '你在说什么，听不懂哦 >_< '
        else:
            reply = reply.decode('utf-8')
        return reply

    def delete(self, key):
        if self.db.delete(key):
            return 'ok'


if __name__ == '__main__':
    print('请不要直接执行本脚本')
